﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class VanningQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlOrderIDOper;
        protected DropDownList ddlOrderType;
        protected DropDownList ddlOrderTypeOper;
        protected DropDownList ddlRemarkOper;
        protected DropDownList ddlVanningDateOper;
        protected DropDownList ddlVanningIDOper;
        protected HtmlForm F7540;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected HtmlImage img1;
        protected HtmlImage img2;
        protected Label lblOrderID;
        protected Label lblOrderType;
        protected Label lblQuery;
        protected Label lblRemark;
        protected Label lblVanningDate;
        protected Label lblVanningID;
        protected HtmlLink mycss;
        protected TextBox txtOrderID;
        protected TextBox txtRemark;
        protected TextBox txtVanningDate;
        protected TextBox txtVanningDate2;
        protected TextBox txtVanningID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("VanningList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("VanningList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void InitDropDownLists()
        {
            base.BindData2DDLBySysCode(this.ddlOrderType, "DOC_TYPE");
            base.InitQueryDDL(this.ddlVanningIDOper, 0);
            base.InitQueryDDL(this.ddlOrderTypeOper, 0);
            base.InitQueryDDL(this.ddlOrderIDOper, 0);
            base.InitQueryDDL(this.ddlRemarkOper, 0);
            base.InitQueryDDL(this.ddlVanningDateOper, 1);
            this.ddlOrderType.Items.Insert(0, new ListItem("-----", ""));
            this.ddlOrderTypeOper.SelectedValue = "Same As";
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnNew.Visible = false;
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string OrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderID.Text.Trim(), this.ddlOrderIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string OrderType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlOrderType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlOrderType.SelectedValue, this.ddlOrderTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Remark
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtRemark.Text.Trim()))
                {
                    return base.GetParamsString(this.txtRemark.Text.Trim(), this.ddlRemarkOper.SelectedValue);
                }
                return "";
            }
        }

        public string VanningDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVanningDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVanningDate.Text.Trim(), this.ddlVanningDateOper.SelectedValue, this.txtVanningDate2.Text.Trim(), "VanningDate");
                }
                return "";
            }
        }

        public string VanningID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVanningID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVanningID.Text.Trim(), this.ddlVanningIDOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

